package javabean.test;

import com.fasterxml.jackson.databind.ObjectMapper;
import javabean.ResultData;
import javabean.User;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;

/**
 * packageName com.tomorrow.bms.javabean.test
 *
 * @author Administrator
 * @version 1.0
 * @className test
 * @date 2024/8/26
 * @description
 */
public class test {
    public static void main(String[] args) {
        ObjectMapper mapper = new ObjectMapper();
        ObjectMapper mapper1 = new ObjectMapper();
        String jsonString = "{\"name\":\"Mahesh\", \"age\":21}";

        try {
            User a = new User("userName",  "passWord",  "name",  "email",  0.0);
            ArrayList<User> ss = new ArrayList<>();
            Collections.addAll(ss, a, a, a, a, a);
            // 序列化对象到 JSON
            String json = mapper.writeValueAsString(new ResultData<User>(200,"a", ss));
            System.out.println(json);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}